<%-- 
    Document   : viewProductBody
    Created on : Nov 18, 2012, 7:53:14 PM
    Author     : tuan
--%>

<%@page import="java.util.Iterator"%>
<%@page import="java.util.Iterator"%>
<%@page import="data.ProductDAL"%>
<%@page import="data.ProductEntity"%>
<%@page import="data.ProductEntity"%>
<%@page import="java.util.Collection"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body>
        <div>
            <table>
                <%
                    String categoryID = request.getParameter("cateID");
                    if (categoryID == null) {
                        categoryID = "C01";
                        Collection<ProductEntity> list1 = ProductDAL.listByCategoryID(categoryID);
                        Iterator<ProductEntity> it = list1.iterator();
                %>
                <tr>
                    <%
                        while (it.hasNext()) {
                            //  for(int i = 0 ; i < list.size() ; i++){
                            ProductEntity entity = it.next();
                    %>
                    <td>
                        <div>
                            <table border="0" cellpadding="0" style="border:1px solid #C0C0C0; border-collapse: collapse" width="167" id="table50">
                                <tr>
                                    <td height="10"></td>
                                </tr>
                                <tr>
                                    <td height="24"><center><a onmouseover="doTooltip(event, '129695728.jpg')" onmouseout=hideTip() href="viewProductDetails.jsp?productID=<%=entity.getProductId()%>"   rel="do480">
                                        <img border="0" src="<%=entity.getProductImage()%>" width="150" height="150" align="center"></a></center></td>

                                </tr>
                                <tr>
                                    <td height="24"><center>
                                    <a href="viewProductDetails.jsp?productID=<%=entity.getProductId()%>" class=link31><%=entity.getProductName()%></a></center>
                                </td>
                                </tr>
                                <tr>
                                    <td height="22"><center>
                                    <a href="viewProductDetails.jsp?productID=<%=entity.getProductId()%>" class=link310> Product ID<%=entity.getProductId()%></a></center>
                                </td>
                                </tr>
                                <tr>
                                    <td height="22"><center>
                                    <a href="viewProductDetails.jsp?productID=<%=entity.getProductId()%>" class=link310>Price : <font color=red><%=entity.getUnitPrice()%></font></a></center>
                                </td>
                                </tr>
                                <tr>
                                    <td height="22">
                                        <a href="../viewProduct/viewProductDetails.jsp?productID=<%=entity.getProductId()%>">
                                            <img border="0" src="../images/dathang.jpg" width="166" height="31"></a></td>
                                </tr>
                                <tr>
                                    <td height="10"></td>
                                </tr>
                            </table>
                        </div>
                    </td>
                    <%
                        }
                        return;
                    } else {
                        Collection<ProductEntity> list = ProductDAL.listByCategoryID(categoryID);
                        Iterator<ProductEntity> it = list.iterator();
                        while (it.hasNext()) {
                            ProductEntity pentity = it.next();
                    %>
                    <td>

                        <h1> <a href="../viewProduct/viewProductDetails.jsp?productID=<%pentity.getProductId();%>">Edit</a> </h1>


                        <div>

                            <table border="0" cellpadding="0" style="border:1px solid #C0C0C0; border-collapse: collapse" width="167" id="table50">
                                <tr>
                                    <td height="10"></td>
                                </tr>
                                <tr>
                                    <td height="24"><center><a onmouseover="doTooltip(event, '129695728.jpg')" onmouseout=hideTip() href="viewProductDetails.jsp?productID=${pentity.getProductId()}"   rel="do480">
                                        <img border="0" src="<%=pentity.getProductImage()%>" width="150" height="150" align="center"></a></center></td>

                                </tr>
                                <tr>
                                    <td height="24"><center>
                                    <a href="viewProductDetails.jsp?productID=${pentity.getProductId()}" class=link31><%=pentity.getProductName()%></a></center>
                                </td>
                                </tr>
                                <tr>
                                    <td height="22"><center>
                                    <a href="viewProductDetails.jsp?productID=${pentity.getProductId()}" class=link310>Product ID<%=pentity.getProductId()%></a></center>
                                </td>
                                </tr>
                                <tr>
                                    <td height="22"><center>
                                    <a href="viewProductDetails.jsp?productID=${pentity.getProductId()})}" class=link310>Price : <font color=red><%=pentity.getUnitPrice()%></font></a></center>
                                </td>
                                </tr>
                                <tr>
                                    <td height="22">
                                        <a href="../viewProduct/viewProductDetails.jsp?productID=<%=pentity.getProductId()%>">
                                            <img border="0" src="../images/dathang.jpg" width="166" height="31"></a></td>
                                </tr>
                                <tr>
                                    <td height="10"></td>
                                </tr>
                            </table>
                        </div>
                    </td>

                    <%
                            }
                        }
                    %>
                </tr>

            </table>
        </div>
    </body>
</html>
